home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / R4REPORT.H < prev    next >
C/C++ Source or Header  |  1993-03-03  |  12KB  |  382 lines

  1. /* r4report.h   (c)Copyright Sequiter Software Inc., 1991-1993.  All rights reserved. */
  2.  
  3. #define text4displayed 1
  4. #define text4disp_once 2
  5. #define text4display_always 3
  6.  
  7. #define obj4expr 0
  8. #define obj4label 1
  9. #define obj4field 2
  10. #define obj4total 3
  11.  
  12. #define text4number 0
  13. #define text4exponent 1
  14. #define text4dollar 2
  15. #define text4percent 3
  16.  
  17. #define text4left 0
  18. #define text4center 1
  19. #define text4right 2
  20.  
  21. #define total4lowest 11
  22. #define total4highest 12
  23. #define total4count 13
  24. #define total4average 14
  25. #define total4sum 15
  26.  
  27.  
  28. #ifndef S4WINDOWS
  29.  
  30.    #define LF_FACESIZE         32
  31.  
  32.    typedef struct tagRECT
  33.    {
  34.       int left;
  35.       int top;
  36.       int right;
  37.       int bottom;
  38.    } RECT ;
  39.  
  40.    typedef unsigned short HDC ;
  41.    typedef unsigned short HWND;
  42.    typedef unsigned short HFONT;
  43.    typedef unsigned char       BYTE;
  44.    typedef unsigned short      WORD;
  45.    typedef unsigned long       DWORD;
  46.  
  47.    typedef unsigned int        UINT;
  48.  
  49.    typedef struct tagLOGFONT
  50.    {
  51.       short int lfHeight;
  52.       short int lfWidth;
  53.       short int lfEscapement;
  54.       short int lfOrientation;
  55.       short int lfWeight;
  56.       BYTE      lfItalic;
  57.       BYTE    lfUnderline;
  58.       BYTE    lfStrikeOut;
  59.       BYTE    lfCharSet;
  60.       BYTE    lfOutPrecision;
  61.       BYTE    lfClipPrecision;
  62.       BYTE    lfQuality;
  63.       BYTE    lfPitchAndFamily;
  64.       BYTE    lfFaceName[LF_FACESIZE];
  65.    } LOGFONT ;
  66.  
  67.    typedef long COLORREF;
  68.    typedef unsigned HANDLE;
  69.    typedef unsigned HBITMAP;
  70.  
  71.    typedef struct tagPOINT {
  72.       int x;
  73.       int y;
  74.    } POINT ;
  75.  
  76. #endif
  77.  
  78.  
  79.  
  80.  
  81. struct REPORT4st ;
  82. struct TOTAL4st ;
  83. struct GROUP4st ;
  84. struct OBJECTS4st ;
  85.  
  86. typedef struct
  87. {
  88.    LINK4 link ;
  89.    int object_type ;  /* obj4expr, obj4label, */
  90.               /* obj4total, obj4field */
  91.    int x,y ; /* Do not change order of x,y;  Used as a Windows point */
  92.    int w ;  /* In inches */
  93.    RECT r ;  /* In device coordinates */
  94.              /* Calculated just before report */
  95.    int display_status ;/* text4display_once, text4displayed, */
  96.                /* text4display_always */
  97.    struct OBJECTS4st *list ; /* Pointer to the corresponding list */
  98.    HWND  hWnd ;        /* Handle to corresponding design window. */
  99.    int   is_selected ;
  100. } OBJ4 ;
  101.  
  102. typedef struct
  103. {
  104.    LINK4 link ;
  105.    OBJ4  *ptr ;
  106. } OBJ4PTR ;
  107.  
  108. typedef struct
  109. {
  110.    LINK4  link ;
  111.    char name[20] ;
  112.    HFONT   hFont ;
  113.    LOGFONT  lf ;
  114.    COLORREF  color ;
  115.    int iptsize ;
  116.    int codes_before_len, codes_after_len ;
  117.    char *codes_before, *codes_after ;
  118. } STYLE4 ;
  119.  
  120. typedef struct
  121. {
  122.    OBJ4 obj ;
  123.    STYLE4 *style ;
  124.    int  len_max ;    /* The maximum number of characters to display */
  125.    int  len ;
  126.    int  dec ;
  127.    int  alignment ;    /* text4left, text4center, text4right */
  128.    int  numeric_type ; /* text4exponent, text4dollar, */
  129.                        /* text4percent, text4number */
  130.    char use_brackets ; /* TRUE/FALSE - Use brackets for negative numbers ? */
  131.    char display_zero ;
  132.    char *date_format ; /* If null, use default */
  133.  
  134.    EXPR4 *expr ;      /* For expression */
  135.    FIELD4 *field ;    /* For field */
  136.    char *ptr ;         /* For label */
  137.    struct TOTAL4st *total ;  /* For total */
  138.    struct GROUP4st *reset_group ;
  139. } TEXT4 ;
  140.  
  141. typedef struct TOTAL4st
  142. {
  143.    LINK4 link ;
  144.    EXPR4CALC *calc_ptr ; /* A total is a calculation for easy removal/name changes */
  145.  
  146.    short  total_type ;  /* total4lowest, total4highest, total4sum, */
  147.                       /* total4count, total4average */
  148.    struct GROUP4st *reset_level ;
  149.    struct REPORT4st *report ;
  150.    double total ;  /* Running Total */
  151.    double low ;    /* Lowest Value */
  152.    double high ;   /* Hightest Value */
  153.    long count ;    /* Running Count */
  154. } TOTAL4 ;
  155.  
  156. typedef struct OBJECTS4st
  157. {
  158.    LIST4 list ; /* A list of OBJ4 */
  159.    struct GROUP4st *group ; /* The corresponding Group; if any */
  160.    int height ; /* In 1/1000 inch */
  161.    int height_dev ; /* In device units */
  162.    struct REPORT4st *report ;
  163.    HWND  hWnd ;  /* Handle to corresponding design window. */
  164.    HWND  hWndInfo ;  /* Status information of object list */
  165. } OBJECTS4 ;
  166.  
  167. typedef struct GROUP4st
  168. {
  169.    LINK4 link ;
  170.    struct REPORT4st *report ;
  171.  
  172.    EXPR4  *expr ;
  173.    char    *value ;
  174.    int      value_len ;
  175.  
  176.    int position ;  /* Linked list position; used to figure total resets */
  177.  
  178.    OBJECTS4  header ;
  179.    int swap_header ;
  180.    int repeat_header ;
  181.  
  182.    OBJECTS4  footer ;  /* List of DisplayObject */
  183.    int swap_footer ;
  184.  
  185.    int reset_page ;
  186.  
  187.    char label[12] ;
  188. } GROUP4 ;
  189.  
  190. typedef struct REPORT4st
  191. {
  192.    CODE4   *cb ;
  193.    RELATE4 *relate ;  /* Structure R4RELATION is not part of the interface */
  194.  
  195.    MEM4 *text_memory ;
  196.    MEM4 *style_memory ;
  197.  
  198.    LIST4  groups ;       /* A list of GROUP4 */
  199.    LIST4  styles ;       /* A list of STYLE4, Selected is Default. */
  200.  
  201.    STYLE4 *def_style;
  202.  
  203.    OBJECTS4  page_header ;
  204.    OBJECTS4  page_footer ;
  205.  
  206.    OBJECTS4  title ;      
  207.    OBJECTS4  summary ;    
  208.  
  209.    long  page_no ;
  210.    long  rec_no ;
  211.    int   y ;         /* 0 - Top of page. */
  212.    int   in_new_page ;  /* Insure that 'new_page()' is not called recursively */
  213.    int   first ;
  214.  
  215.    char *printer_name ;
  216.    char *report_name ;
  217.    HDC   hDC ; /* Display Context Handle for report output. */
  218.  
  219.    int   margin_top ;
  220.    int   margin_bottom ;
  221.    int   margin_left ;
  222.    int   report_width ;
  223.    int   margin_right ;
  224.    char  decimal_point ;
  225.    char  thousand_separator ;
  226.    char  currency_sym ;
  227.    char  leading_zero ;
  228.  
  229.    HBITMAP hBitMap ;
  230.    HWND    hWnd ;
  231.    HDC     hDCdisplay ;
  232.    int     report_command ;
  233.    HWND    hWndParent ;
  234.  
  235.    int     to_screen ;  /* In Windows True if the output is to go to the screen. False if to printer. */
  236.    int     is_registered ;
  237.  
  238.    /* Information for designer. */
  239.    int hide_info ; /* True/False - Hide list information windows ? */
  240.    int   units ;  /* units4inches; units4cent; units4points */
  241.  
  242.    int sensitivity_x ; /* In 1/1000 of an inch.  Modulus on object pos. */
  243.    int sensitivity_y ;
  244.    int sensitivity_adjust ; /* Adjust object positions when sensitivity changed */
  245.    int sheight, swidth, cline, cx ;
  246.    int output_handle,use_styles ;
  247. } REPORT4 ;
  248.  
  249.  
  250. #ifdef __cplusplus
  251.    extern "C" {
  252. #endif
  253.  
  254.  
  255. #ifdef S4WINDOWS
  256.    long FAR PASCAL _export report4output_proc( HWND, unsigned, unsigned, LONG ) ;
  257.    long FAR PASCAL _export report4cancel_proc( HWND, unsigned, unsigned, LONG ) ;
  258. #endif
  259.  
  260. int S4FUNCTION e4string( EXPR4 *, char **, int, int ) ;
  261. int S4FUNCTION dc4mapping( HDC hDC ) ; /* Sets coordinates to 1/1000 Inch */
  262.  
  263. int  S4FUNCTION obj4display( OBJ4 *, REPORT4 *, int ) ;
  264. int  obj4width( OBJ4 *, int ) ;  /* Sets the maximum width */
  265. void S4FUNCTION obj4free( OBJ4 * ) ;
  266.  
  267. OBJ4 S4PTR * S4FUNCTION obj4first( REPORT4 * ) ;
  268. OBJ4 S4PTR * S4FUNCTION obj4next( OBJ4 * ) ;
  269.  
  270. OBJECTS4 S4PTR * S4FUNCTION objects4first( REPORT4 * ) ;
  271. OBJECTS4 S4PTR * S4FUNCTION objects4next( OBJECTS4 * ) ;
  272.  
  273. int  S4FUNCTION objects4display( OBJECTS4 * ) ;
  274. int  S4FUNCTION objects4height( OBJECTS4 *, int ) ; /* Returns the height of the list */
  275. void S4FUNCTION objectsort4init( OBJECTS4 *, REPORT4 *, GROUP4 * ) ;
  276. void S4FUNCTION objects4purge( OBJECTS4 * ) ;
  277.  
  278.  
  279. int S4FUNCTION report4display_repeat_headers(  REPORT4 *, GROUP4 * ) ;
  280. int S4FUNCTION report4new_page( REPORT4 *, int ) ;  /* Ejects, increments page# */
  281.  
  282. int S4FUNCTION report4update_expressions( REPORT4 * ) ;
  283.  
  284. /* User Interface */
  285. void   S4FUNCTION text4alignment( TEXT4 *, int ) ;
  286. void   S4FUNCTION text4numeric( TEXT4 *, int ) ;
  287. void   S4FUNCTION text4dec( TEXT4 *, int ) ;
  288. void   S4FUNCTION text4display_zero( TEXT4 *, int ) ;
  289. void   S4FUNCTION text4len_max( TEXT4 *, int ) ;
  290. void   S4FUNCTION text4len_set( TEXT4 * ) ;
  291. void   S4FUNCTION text4use_brackets( TEXT4 *, int ) ;
  292. void   S4FUNCTION text4display_once( TEXT4 *, GROUP4 * );
  293. int    S4FUNCTION text4convert_double( OBJ4 *, double, char * ) ; /* Returns # of character's used, trim's on left. */
  294. int    S4FUNCTION text4conv_double( TEXT4 *, double , char * );
  295. int    S4FUNCTION text4width( TEXT4 *, int );
  296. int    S4FUNCTION text4date_format( TEXT4 *, char * ) ;
  297. char   *text4ptr( TEXT4 * ) ;
  298.  
  299. TEXT4  S4PTR * S4FUNCTION text4create( OBJECTS4 *, int, int ) ; /* Does initial create work */
  300. TEXT4  S4PTR * S4FUNCTION text4expr(  OBJECTS4 *, int, int, char * ) ;
  301. TEXT4  S4PTR * S4FUNCTION text4field( OBJECTS4 *, int, int, FIELD4 * ) ;
  302. TEXT4  S4PTR * S4FUNCTION text4label( OBJECTS4 *, int, int, char * ) ;
  303. TEXT4  S4PTR * S4FUNCTION text4total( OBJECTS4 *, int, int, TOTAL4 * ) ;
  304. STYLE4 S4PTR * S4FUNCTION text4style( TEXT4 *, STYLE4 * ) ;
  305.  
  306. #ifdef S4WINDOWS
  307.    int S4FUNCTION text4width_estimate( TEXT4 *, TEXTMETRIC * ) ; /* Estimate the width (if max. use it) */
  308. #endif
  309.  
  310. unsigned S4FUNCTION u4ncat( char *, char *, unsigned ) ;
  311.  
  312. int      S4FUNCTION report4program( REPORT4 *, char *, char *, int );
  313. int         S4FUNCTION report4display( REPORT4 *, int ) ; /* Display report to screen ? */
  314. int      S4FUNCTION report4do( REPORT4 * ) ;
  315. int      S4FUNCTION report4dc_free( REPORT4 * ) ;
  316. int      S4FUNCTION report4dc_page_height( REPORT4 * ) ; /* In 1/1000 of an Inch */
  317. int      S4FUNCTION report4layout( REPORT4 * ) ; /* Create an instant layout for the report */
  318. int      S4FUNCTION report4printer( REPORT4 *, char * ) ;
  319. int      S4FUNCTION report4save( REPORT4 *, char * ) ;
  320. int        S4FUNCTION report4currency(REPORT4 *, char );
  321. int         S4FUNCTION report4symbols_numeric(REPORT4 *, int, int ) ;
  322. int      S4FUNCTION group4expr( GROUP4 *, char * ) ; /* Set condition for new group */
  323. int      S4FUNCTION group4name_set( GROUP4 *, char * );
  324. void     S4FUNCTION report4leading_zero( REPORT4 *, int ) ;
  325. void     S4FUNCTION report4message_loop( REPORT4 * ) ;
  326. void     S4FUNCTION report4parent( REPORT4 *, HWND ) ;
  327. void     S4FUNCTION report4register_classes( REPORT4 *) ;
  328. void     S4FUNCTION report4free( REPORT4 *, int, int ) ;
  329.  
  330. HDC      S4FUNCTION report4dc_get( REPORT4 * ) ;
  331.  
  332. GROUP4   S4PTR * S4FUNCTION report4calc_first_change_group( REPORT4 * ) ;
  333. GROUP4   S4PTR * S4FUNCTION group4lookup( REPORT4 *, char * ) ;
  334. GROUP4   S4PTR * S4FUNCTION group4create( REPORT4 * ) ;
  335.  
  336. REPORT4  S4PTR * S4FUNCTION report4retrieve( CODE4 *, char *, int ) ;
  337. REPORT4  S4PTR * S4FUNCTION report4init( RELATE4 * ) ;
  338.  
  339. void     S4FUNCTION report4driver_init_undo(void);
  340. void     S4FUNCTION report4output( REPORT4 *, int, char *, int );
  341. int      S4FUNCTION report4driver_init( REPORT4 *, int, char * );
  342. int      S4FUNCTION report4driver_new_page(void);
  343. int      S4FUNCTION report4driver_write( int, int, char *, int, 
  344.                    char *, int, char *, int );
  345.  
  346.  
  347.  
  348. TOTAL4   S4PTR * S4FUNCTION total4create( REPORT4 *, char *, char *, int ) ;
  349. TOTAL4   S4PTR * S4FUNCTION total4create_total( REPORT4 *, char *, EXPR4 *, int ) ;
  350. TOTAL4   S4PTR * S4FUNCTION total4lookup( REPORT4 *, char * ) ; /* Must call from expr4parse */
  351. double   S4FUNCTION total4value( struct TOTAL4st * ) ; /* Must call from e4new_total */
  352. void     S4FUNCTION total4reset_level( TOTAL4 *, GROUP4 * ) ;
  353. void     S4FUNCTION total4value_reset(TOTAL4 *);
  354. void        S4FUNCTION total4value_update( TOTAL4 *, GROUP4 * );
  355.  
  356. void     S4FUNCTION style4color( STYLE4 *, COLORREF ) ;
  357. int      S4FUNCTION style4default_create( REPORT4 * ) ;
  358.  
  359. #ifdef   S4WINDOWS
  360. STYLE4   S4PTR * S4FUNCTION style4create( REPORT4 *, char *, LOGFONT * ) ;
  361. #endif
  362.  
  363. #ifndef  S4WINDOWS
  364. STYLE4   S4PTR * S4FUNCTION style4create( REPORT4 *, char *,
  365.                        char *, int, char *, int );
  366. #endif
  367.  
  368. STYLE4   S4PTR * S4FUNCTION style4default_set( REPORT4 *, STYLE4 * ) ;
  369. STYLE4   S4PTR * S4FUNCTION style4lookup( REPORT4 *, char * ) ;
  370.  
  371. void     S4FUNCTION report4page_size( REPORT4 *, int, int ) ;
  372. int      S4FUNCTION report4position( int, int ) ;
  373.  
  374. int S4FUNCTION  report4parse_sstring( char *, char *, int);
  375. void S4FUNCTION report4to_hex(char *, char *);
  376. void S4FUNCTION report4unparse_sstring( char *, char *, int );
  377.  
  378. #ifdef __cplusplus
  379.    }
  380. #endif
  381.  
  382.